import 'package:flutter/material.dart';

class MyApp7 extends StatelessWidget {
  const MyApp7({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        //导航条
        appBar: AppBar(
          title: const Text('Image组件',
              style: TextStyle(
                  fontSize: 20,
                  fontWeight: FontWeight.bold,
                  color: Colors.white)),
          backgroundColor: Colors.pink,
          centerTitle: true,
        ),
        //主体区域
        body: Center(
          //加载网络图片
          //     child: Image.network(
          //   'https://yanxuan-item.nosdn.127.net/e529b6ab111ade9da9314867f98d360f.png',
          //   fit: BoxFit.contain,
          // )
          // 加载本地图片
          child: Container(
            // width: 200,
            // height: 200,
            color: Colors.cyan,
            child: Image.asset(
              //本地图片宽高不能超过最大值
              'qiche.png',
              width: 20,
              height: 20,
            ),
          ),
        ));
  }
}
